<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>

    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<!-- header -->
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <div class="header" style="margin-bottom: 0;">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack(1)" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>热度排行榜</h6>
        </div>
        <!--<div class="head-action">-->
        <!--<a href="javascript:void(0);" tapmode onclick="commonUrl('follow_school')" class="action-btn"></a>-->
        <!--</div>-->
    </div>
</div>
<!-- header end -->
<div class="header-h" style="padding-top: 1.4rem;"></div>
<div class="ranking-list">
    <ul id="listRanking">
        <!--<li tapmode onclick="commonUrl()">
            <div class="user-info">
                <div class="rank-num"></div>
                <div class="info-img bg-cover" style="background: url('../../image/img-tx.png');"></div>
                <p class="user-name">笑着笑着面瘫了</p>
                <dl class="badge-list">
                    <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                </dl>
            </div>
            <div class="hot-rank">26580</div>
        </li>
        <li tapmode onclick="commonUrl()">
            <div class="user-info">
                <div class="rank-num"></div>
                <div class="info-img bg-cover" style="background: url('../../image/img-tx.png');"></div>
                <p class="user-name">笑着笑着面瘫了</p>
                <dl class="badge-list">
                    <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                </dl>
            </div>
            <div class="hot-rank">26580</div>
        </li>
        <li tapmode onclick="commonUrl()">
            <div class="user-info">
                <div class="rank-num"></div>
                <div class="info-img bg-cover" style="background: url('../../image/img-tx.png');"></div>
                <p class="user-name">笑着笑着面瘫了</p>
                <dl class="badge-list">
                    <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                </dl>
            </div>
            <div class="hot-rank">26580</div>
        </li>
        <li tapmode onclick="commonUrl()">
            <div class="user-info">
                <div class="rank-num"><span>4</span></div>
                <div class="info-img bg-cover" style="background: url('../../image/img-tx.png');"></div>
                <p class="user-name">笑着笑着面瘫了</p>
                <dl class="badge-list">
                    <dd class="icon"><img src="../../icon/icon-hz01.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz02.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz03.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz04.png" alt=""></dd>
                    <dd class="icon"><img src="../../icon/icon-hz05.png" alt=""></dd>
                </dl>
            </div>
            <div class="hot-rank">26580</div>
        </li>-->

    </ul>
</div>
<style type="text/css">
    .userRelative {
        position: relative;
        width: 0.6rem;
        height: 0.6rem;
        margin-right: 0.15rem;
    }
</style>

</body>
</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    var circle_id = '';
    var page = 1;
    var pagePath = '';
    apiready = function () {

        setFixStatusBar(); //设置状态栏
        pop.loading();
        keybackListener()

        circle_id = api.pageParam.circle_id;
        pagePath = api.pageParam.path;


        getHotRanking()

        pullUpLoading(function () {
            getHotRanking()
        })
    }



    //获取热度排行榜
    function getHotRanking() {
        var param = {
            token: $api.getStorage('token'),
            circle_id: circle_id,
            page: page,
        }
        getAjax(Interface.circle_hotmember, param, function (res) {
            var data = res.data.list;
            if (isDefine(data)) {
                var rankHtml = ''
                for (var i = 0; i < data.length; i++) {
                    var badge = '';

                    var member = data[i].member;
                    if (isDefine(member.badge_path)) {
                        for (var k = 0; k < member.badge_path.length; k++) {
                            badge += '<dd class="icon"><img src="' + ajaxUrl + member.badge_path[k] + '" alt=""></dd>';
                        }
                    }

                    var userVip = '';
                    if(isDefine(member.attestation_status)){
                        if(member.attestation_status == 2){
                            userVip = '<span class="vip"></span>';
                        }
                    }
                    var user_id = $api.getStorage('userInfo').id;
                    var userParam = {'member_id': data[i].member_id};

                    if (i < 3) {
                        if(data[i].member_id == user_id){
                            rankHtml += '<li>' +
                                '            <div class="user-info">' +
                                '                <div class="rank-num"></div>' +
                                '                <div class="userRelative"><div class="info-img bg-cover" style="background: url(' + ajaxUrl + member.icon_path + ');"></div>'+userVip+'</div>' +
                                '                <p class="user-name">' + member.name + '</p>' +
                                '                <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badge + ' </dl>' +
                                '            </div>' +
                                '            <div class="hot-rank">' + data[i].hot_number + '</div>' +
                                '        </li>'
                        }else {
                            rankHtml += '<li tapmode onclick=\'commonUrl("../activity/person_index",'+jsonChange(userParam)+')\'>' +
                                '            <div class="user-info">' +
                                '                <div class="rank-num"></div>' +
                                '                <div class="userRelative"><div class="info-img bg-cover" style="background: url(' + ajaxUrl + member.icon_path + ');"></div>'+userVip+'</div>' +
                                '                <p class="user-name">' + member.name + '</p>' +
                                '                <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badge + ' </dl>' +
                                '            </div>' +
                                '            <div class="hot-rank">' + data[i].hot_number + '</div>' +
                                '        </li>'
                        }


                    } else {
                        var rank_index = i + 1;
                        if(data[i].member_id == user_id){
                            rankHtml += '<li>' +
                                '            <div class="user-info">' +
                                '                <div class="rank-num"><span>' + rank_index + '</span></div>' +
                                '                <div class="userRelative"><div class="info-img bg-cover" style="background: url(' + ajaxUrl + member.icon_path + ');"></div>'+userVip+'</div>' +
                                '                <p class="user-name">' + member.name + '</p>' +
                                '                <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badge + ' </dl>' +
                                '            </div>' +
                                '            <div class="hot-rank">' + data[i].hot_number + '</div>' +
                                '        </li>'
                        }else {
                            rankHtml += '<li tapmode onclick=\'commonUrl("../activity/person_index",'+jsonChange(userParam)+')\'>' +
                                '            <div class="user-info">' +
                                '                <div class="rank-num"><span>' + rank_index + '</span></div>' +
                                '                <div class="userRelative"><div class="info-img bg-cover" style="background: url(' + ajaxUrl + member.icon_path + ');"></div>'+userVip+'</div>' +
                                '                <p class="user-name">' + member.name + '</p>' +
                                '                <dl class="badge-list" tapmode onclick="toBadgePage(event)">' + badge + ' </dl>' +
                                '            </div>' +
                                '            <div class="hot-rank">' + data[i].hot_number + '</div>' +
                                '        </li>'
                        }

                    }

                }

                if (page == 1) {
                    // console.log(rankHtml)
                    $("#listRanking").html(rankHtml)

                } else {
                    //$("#listRanking").append(rankHtml)
                }
                page++ ;
            } else {
                if (page == 1) {
                    $("#listRanking").html(noData)

                } else {
                    //$("#listRanking").append('<p style="width: 100%;" class="t-c c-999">没有更多了</p>')
                }
            }
            pop.close();
        }, function (error) {
            $("#listRanking").html(noData)
            pop.notice(error.msg)
            pop.close();
        })
    }


</script>
